package com.sm.controller;

import java.util.List;

import com.sm.model.IncomeDetail;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.sm.service.IncomeDetailService;
import com.sm.util.Msg;

@Controller
@RequestMapping("/incomeDetail")
public class IncomeDetailController {

	@Autowired
	private IncomeDetailService incomeDetailService;
	
	/**
	 * 获取用户收入明细
	 * @param userId
	 * @return
	 */
	@RequestMapping("/getIncomeDetailByUserId")
	@ResponseBody
	public Msg getIncomeDetailByUserId(@RequestParam("userId")Integer userId) {
		if(userId==null) {
			return Msg.fail().add("msg", "参数不为空！");
		}
		List<IncomeDetail> list = incomeDetailService.selectByUserId(userId);
		return Msg.success().add("list", list);
	}
}
